﻿Imports System.Windows.Forms

Public Class MDIPrincipal
#Region "variables"
    Dim _frmManteProveedores As DNP.GestionComercial.FRM.frmLstProveedores
    Dim _frmManteEmpleados As DNP.GestionComercial.FRM.frmMantEmpleados
    Dim _frmManteProductos As DNP.GestionComercial.FRM.frmMantProductos
    Dim _frmVentas As DNP.GestionComercial.FRM.frmVentas
    Dim _frmManteCliente As DNP.GestionComercial.FRM.frmManClientes

#End Region

    Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs) Handles NewToolStripMenuItem.Click
        ' Cree una nueva instancia del formulario secundario.
        Dim ChildForm As New System.Windows.Forms.Form
        ' Conviértalo en un elemento secundario de este formulario MDI antes de mostrarlo.
        ChildForm.MdiParent = Me

        m_ChildFormNumber += 1
        ChildForm.Text = "Ventana " & m_ChildFormNumber

        ChildForm.Show()
    End Sub

    Private Sub OpenFile(ByVal sender As Object, ByVal e As EventArgs) Handles OpenToolStripMenuItem.Click
        Dim OpenFileDialog As New OpenFileDialog
        OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        OpenFileDialog.Filter = "Archivos de texto (*.txt)|*.txt|Todos los archivos (*.*)|*.*"
        If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = OpenFileDialog.FileName
            ' TODO: agregue código aquí para abrir el archivo.
        End If
    End Sub

    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SaveAsToolStripMenuItem.Click
        Dim SaveFileDialog As New SaveFileDialog
        SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        SaveFileDialog.Filter = "Archivos de texto (*.txt)|*.txt|Todos los archivos (*.*)|*.*"

        If (SaveFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = SaveFileDialog.FileName
            ' TODO: agregue código aquí para guardar el contenido actual del formulario en un archivo.
        End If
    End Sub


    Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Utilice My.Computer.Clipboard para insertar el texto o las imágenes seleccionadas en el Portapapeles
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Utilice My.Computer.Clipboard para insertar el texto o las imágenes seleccionadas en el Portapapeles
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        'Utilice My.Computer.Clipboard.GetText() o My.Computer.Clipboard.GetData para recuperar la información del Portapapeles.
    End Sub





  

    Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.ArrangeIcons)
    End Sub

    Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Cierre todos los formularios secundarios del principal.
        For Each ChildForm As Form In Me.MdiChildren
            ChildForm.Close()
        Next
    End Sub

    Private m_ChildFormNumber As Integer


    Private Sub STMIProveedores_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STMIProveedores.Click
        If _frmManteProveedores Is Nothing OrElse _frmManteProveedores.IsDisposed Then
            _frmManteProveedores = New DNP.GestionComercial.FRM.frmLstProveedores()
            _frmManteProveedores.WindowState = FormWindowState.Maximized
            _frmManteProveedores.MdiParent = Me
        Else
            _frmManteProveedores.BringToFront()
        End If
        _frmManteProveedores.Show()
    End Sub

    

    Private Sub STMIProductos_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STMIProductos.Click
        If _frmManteProductos Is Nothing OrElse _frmManteProductos.IsDisposed Then
            _frmManteProductos = New DNP.GestionComercial.FRM.frmMantProductos
            _frmManteProductos.WindowState = FormWindowState.Maximized
            _frmManteProductos.MdiParent = Me
        Else
            _frmManteProductos.BringToFront()
        End If
        _frmManteProductos.Show()
    End Sub

    Private Sub STMIEmpleados_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STMIEmpleados.Click
        If _frmManteEmpleados Is Nothing OrElse _frmManteEmpleados.IsDisposed Then
            _frmManteEmpleados = New DNP.GestionComercial.FRM.frmMantEmpleados()
            _frmManteEmpleados.WindowState = FormWindowState.Maximized
            _frmManteEmpleados.MdiParent = Me
        Else
            _frmManteEmpleados.BringToFront()
        End If
        _frmManteEmpleados.Show()
    End Sub

    Private Sub ListaDeComprasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListaDeComprasToolStripMenuItem.Click

        Dim ofrmOrdenCompra = New DNP.GestionComercial.FRM.frmOrdenCompra
        If frmOrdenCompra Is Nothing OrElse frmOrdenCompra.IsDisposed Then
            ofrmOrdenCompra.MdiParent = Me
            ofrmOrdenCompra.WindowState = FormWindowState.Maximized
        Else
            frmOrdenCompra.BringToFront()
        End If
        ofrmOrdenCompra.Show()

    End Sub

    Private Sub VentasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VentasToolStripMenuItem.Click
        If _frmVentas Is Nothing OrElse _frmVentas.IsDisposed Then
            _frmVentas = New DNP.GestionComercial.FRM.frmVentas
            _frmVentas.WindowState = FormWindowState.Maximized
            _frmVentas.MdiParent = Me
        Else
            _frmVentas.BringToFront()
        End If
        _frmVentas.Show()
    End Sub

    Private Sub STMIClientes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STMIClientes.Click
        If _frmManteCliente Is Nothing OrElse _frmVentas.IsDisposed Then
            _frmManteCliente = New DNP.GestionComercial.FRM.frmManClientes
            _frmManteCliente.WindowState = FormWindowState.Maximized
            _frmManteCliente.MdiParent = Me
        Else
            _frmManteCliente.BringToFront()
        End If
        _frmManteCliente.Show()
    End Sub
End Class
